<template name="tabBar">
	<view class="my_tabbar">
		<block v-for="(item,index) in list" :key="index">
			<view :style="user_type==0&&index==3?('display:none'):('display:flex')" :class="currentTabIndex==index?'my_tabbar_bd my_tabbar_bd_a':'my_tabbar_bd'"
			 @tap="change_page(index,item.pagePath)">
				<view class="my_tabbar_bd_img">
					<image :src="currentTabIndex==index?item.selectedIconPath:item.iconPath"></image>
				</view>
				<view>{{item.text}}</view>
			</view>
		</block>
	</view>
</template>

<script>
	// import { appMessage } from '../ajax.js';
	export default {
		data() {
			return {
				list: [{
					"pagePath": "/pages/index/index",
					"selectedIconPath": "/static/clq-tabBar/purchasetabed1.png",
					"iconPath": "/static/clq-tabBar/purchasetab1.png",
					"text": "首页"
				}, {
					"pagePath": "/pages/clq_about/index/index",
					"selectedIconPath": "/static/clq-tabBar/purchasetabed2.png",
					"iconPath": "/static/clq-tabBar/purchasetab2.png",
					"text": "关于我们"
				}, {
					"pagePath": "/pages/category1/category1",
					"selectedIconPath": "/static/clq-tabBar/purchasetabed3.png",
					"iconPath": "/static/clq-tabBar/purchasetab3.png",
					"text": "商品列表"
				}, {
					"pagePath": "/pages/category2/category2",
					"selectedIconPath": "/static/clq-tabBar/purchasetabed4.png",
					"iconPath": "/static/clq-tabBar/purchasetab4.png",
					"text": "我要供货"
				}, {
					"pagePath": "/pages/mine/mine",
					"selectedIconPath": "/static/clq-tabBar/purchasetabed5.png",
					"iconPath": "/static/clq-tabBar/purchasetab5.png",
					"text": "我的"
				}],
				currentTabIndex: this.current,
				user_type: this.usertype,
				shop_group_id: this.groupid,
				shop_group_name: this.groupname,
			};
		},
		// 此处定义传入的数据
		props: {
			// groupid: { type: [Number, String], default: 0 },
			// groupname: { type: [Number, String], default: 0 },
			current: {
				type: [Number, String],
				default: 0
			},
			// usertype: { type: [Number, String], default: 0 },//用户类型0普通用户1健身房用户
		},
		methods: {
			change_page: function(index, link) {
				let that = this;
				// that.now_page_index = index;
				that.currentTabIndex = index
				console.log(link)
				uni.reLaunch({
					url: link
				});
			},
			// groupchat:function(e){
			// 	let that = this;
			// 	// 点击进入群聊
			// 	let jsonData = {
			// 		action: 'groupchat',
			// 		ID : that.shop_group_id,
			// 		name: that.shop_group_name, 
			// 	}  
			// 	appMessage(jsonData)
			// }

		}
	}
</script>

<style>
	/* 公共底部 */
	.my_tabbar {
		width: 100%;
		box-sizing: border-box;
		display: flex;
		position: fixed;
		left: 0;
		bottom: 0;
		background: #fff;
		justify-content: space-between;
		/* height: 77rpx; */
		font-size: 22rpx;
		font-weight: bold;
		padding: 8rpx 0 13rpx 0;
		border: 1rpx solid #eaeaea;
	}

	.my_tabbar_bd {
		flex: 1;
		text-align: center;
		color: #000;
		display: flex;
		align-items: center;
		flex-direction: column;
		justify-content: center;
	}

	.my_tabbar_bd_img image {
		width: 44rpx;
		height: 44rpx;
		margin-bottom: 12rpx;
	}

	.my_tabbar_bd_a {
		color: #FF7427;
	}
</style>
